﻿<%@ Page Title="" Language="C#" MasterPageFile="~/List.Master" AutoEventWireup="true"
    CodeBehind="DeptList.aspx.cs" Inherits="SGDemo.Permission.DeptList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cpHeader" runat="server">
    <script src="DeptList.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpBody" runat="server">
    <div class="ui-menu">
        <uc:Menu ID="menu1" runat="server" DataFile="../Views/Permission/Menu/DeptList.xml"
            PageCode="DeptList" />
    </div>
    <div class="ui-wrapper">
        <div id="listall" class="ui-content-item ui-content-item-selected">
            <dx:ASPxTreeList ID="tlList" Width="800px" ClientInstanceName="tlList" KeyFieldName="Keyid" DataSourceID="odsList"
                ParentFieldName="ParentKeyid" OnCustomCallback="tlList_CustomCallback" runat="server">
                <Columns>
                    <dx:TreeListDataColumn FieldName="Keyid" Visible="false" />
                    <dx:TreeListDataColumn FieldName="ParentKeyid" Visible="false" />
                    <dx:TreeListDataColumn FieldName="DeptName" VisibleIndex="1" Caption="部门名称" />
                    <dx:TreeListDataColumn FieldName="DeptCode" VisibleIndex="2" Caption="部门编码" />
                    <dx:TreeListDataColumn FieldName="HelpCode" VisibleIndex="3" Caption="助记码" />
                    <dx:TreeListDataColumn Caption="类别" VisibleIndex="4">
                        <DataCellTemplate>
                            <%# ProcessDeptType(Eval("DeptType").ToString())%>
                        </DataCellTemplate>
                    </dx:TreeListDataColumn>
                    <dx:TreeListDataColumn FieldName="DeptType" Visible="false" />
                    <dx:TreeListDataColumn FieldName="Contact" VisibleIndex="5" Caption="联系人" />
                    <dx:TreeListDataColumn FieldName="Remark" VisibleIndex="6" Caption="备注" />
                </Columns>
                <ClientSideEvents NodeDblClick="doNodeDblClick" />
                <SettingsPager Mode="ShowAllNodes" />
                <Styles>
                    <PagerTopPanel>
                        <BorderBottom BorderStyle="Solid" />
                    </PagerTopPanel>
                    <PagerBottomPanel>
                        <BorderTop BorderStyle="Solid" />
                    </PagerBottomPanel>
                    <AlternatingNode Enabled="true" />
                </Styles>
                <Settings GridLines="Both" />
                <SettingsBehavior AllowFocusedNode="true" AutoExpandAllNodes="true" />
                <SettingsLoadingPanel Text="加载中..." />
            </dx:ASPxTreeList>
            <%--数据源控件--%>
            <asp:ObjectDataSource ID="odsList" runat="server" TypeName="SGDemo.Permission.DeptDataSource"
                SelectMethod="FilteredGetAll">
                <SelectParameters>
                    <asp:ControlParameter Name="filterConditions" Type="String" ControlID="hfFilterCondition"
                        PropertyName="Value" ConvertEmptyStringToNull="false" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <%--存储过滤条件--%>
            <asp:HiddenField ID="hfFilterCondition" ClientIDMode="Static" runat="server" Value=" " />
            <%--TreeList数据导出--%>
            <dx:ASPxTreeListExporter ID="tleList" runat="server" TreeListID="tlList" FileName="部门列表">
            </dx:ASPxTreeListExporter>
        </div>
        <div id="search" class="ui-content-item">
            <ul class="ui-list">
                <li>
                    <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="部门名称：" AssociatedControlID="txtDeptName" />
                </li>
                <li>
                    <dx:ASPxTextBox ID="txtDeptName" ClientInstanceName="txtDeptName" runat="server"
                        Width="120px">
                    </dx:ASPxTextBox>
                </li>
                <li>
                    <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="部门编码：" AssociatedControlID="txtDeptCode" />
                </li>
                <li>
                    <dx:ASPxTextBox ID="txtDeptCode" ClientInstanceName="txtDeptCode" runat="server"
                        Width="120px">
                    </dx:ASPxTextBox>
                </li>
                <li>
                    <dx:ASPxLabel ID="lblPhone" runat="server" Text="助记码：" AssociatedControlID="txtHelpCode" />
                </li>
                <li>
                    <dx:ASPxTextBox ID="txtHelpCode" ClientInstanceName="txtHelpCode" runat="server"
                        Width="120px">
                    </dx:ASPxTextBox>
                </li>
                <li>
                    <dx:ASPxLabel ID="lblDeptType" runat="server" Text="类别：" AssociatedControlID="cbDeptType" />
                </li>
                <li>
                    <dx:ASPxComboBox ID="cbDeptType" ClientInstanceName="cbDeptType" runat="server" Width="120">
                        <Items>
                            <dx:ListEditItem Text="公司" Value="0" />
                            <dx:ListEditItem Text="普通部门" Value="1" />
                            <dx:ListEditItem Text="特殊部门" Value="2" />
                        </Items>
                    </dx:ASPxComboBox>
                </li>
            </ul>
            <ul class="sl-floatcenter clearfix">
                <li class="sl-floatcenter-item">
                    <dx:ASPxButton ID="btnSubmit" ClientInstanceName="btnSubmit" runat="server" Text="查 询"
                        AutoPostBack="false">
                        <ClientSideEvents Click="doSubmittedToSearch" />
                    </dx:ASPxButton>
                </li>
                <li class="sl-floatcenter-item">
                    <dx:ASPxButton ID="btnReset" ClientInstanceName="btnReset" runat="server" Text="重 置"
                        AutoPostBack="false">
                        <ClientSideEvents Click="doResetToSearch" />
                    </dx:ASPxButton>
                </li>
            </ul>
        </div>
        <%--导出数据--%>
        <dx:ASPxPopupControl ID="pcExport" ClientInstanceName="pcExport" runat="server" CloseAction="CloseButton"
            LoadContentViaCallback="OnFirstShow" PopupVerticalAlign="WindowCenter" PopupHorizontalAlign="WindowCenter"
            AllowDragging="True" Width="320" Height="200" Modal="true" LoadingPanelText="加载中..."
            HeaderText="导出数据" EnableViewState="False">
            <ContentCollection>
                <dx:PopupControlContentControl ID="pcExportContent" runat="server">
                    <div id="exportDialog">
                        <ul class="ui-list-vertical">
                            <li>
                                <dx:ASPxButton ID="btnExportXls" runat="server" OnClick="btnExporter_Click" AutoPostBack="False"
                                    UseSubmitBehavior="false" CommandName="Xls" Text="Xls文件导出" Width="120" CssClass="ui-btn">
                                </dx:ASPxButton>
                            </li>
                            <li>
                                <dx:ASPxButton ID="btnExportXlsx" runat="server" OnClick="btnExporter_Click" AutoPostBack="False"
                                    UseSubmitBehavior="false" CommandName="Xlsx" Text="Xlsx文件导出" Width="120" CssClass="ui-btn">
                                </dx:ASPxButton>
                            </li>
                            <li>
                                <dx:ASPxButton ID="btnExportPdf" runat="server" OnClick="btnExporter_Click" AutoPostBack="False"
                                    UseSubmitBehavior="false" CommandName="Pdf" Text="Pdf文件导出" Width="120" CssClass="ui-btn">
                                </dx:ASPxButton>
                            </li>
                            <li>
                                <dx:ASPxButton ID="btnExportRtf" runat="server" OnClick="btnExporter_Click" AutoPostBack="False"
                                    UseSubmitBehavior="false" CommandName="Rtf" Text="Rtf文件导出" Width="120" CssClass="ui-btn">
                                </dx:ASPxButton>
                            </li>
                        </ul>
                        <ul class="sl-floatcenter clearfix">
                            <li class="sl-floatcenter-item">
                                <dx:ASPxButton ID="btnCloseToExport" ClientInstanceName="btnCloseToExport" runat="server"
                                    AutoPostBack="False" Text="关 闭">
                                    <ClientSideEvents Click="doCloseToExport" />
                                </dx:ASPxButton>
                            </li>
                        </ul>
                    </div>
                </dx:PopupControlContentControl>
            </ContentCollection>
        </dx:ASPxPopupControl>
    </div>
</asp:Content>
